package com.jiyun.home.service.impl;

import com.jiyun.common.pojo.home.Vehicles;
import com.jiyun.home.mapper.VehiclesMapper;
import com.jiyun.home.service.VehiclesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class VehiclesServiceImpl implements VehiclesService {
    @Autowired
    VehiclesMapper vehiclesMapper;

    /**
     * 覆写 findOne 方法，用于获取单个车辆信息
     *
     * @return Vehicles 返回一个 Vehicles 对象，包含车辆信息
     */
    @Override
    public Vehicles findOne() {
        return vehiclesMapper.findOne();
    }

    /**
     * 覆写 findAll 方法，用于获取所有车辆信息列表
     *
     * @return List<Vehicles> 返回一个包含多个 Vehicles 对象的列表
     */
    @Override
    public List<Vehicles> findAll() {
        return vehiclesMapper.findAll();
    }

    /**
     * 覆写 add 方法，用于添加新的车辆信息
     *
     * @param vehicles Vehicles 对象，包含待添加的车辆信息
     */
    @Override
    public void add(Vehicles vehicles) {
        vehiclesMapper.add(vehicles);
    }

    /**
     * 覆写 delete 方法，根据车辆ID删除车辆信息
     *
     * @param id Integer 类型，代表待删除车辆的ID
     */
    @Override
    public void delete(Integer id) {
        vehiclesMapper.delete(id);
    }

    @Override
    public Vehicles findid(Integer id) {
        return vehiclesMapper.findid(id);
    }
}

